<!-- Emmanuel Nii Tackie
Below is a page containing the authentication form. 
 -->
<html>
<head> 
	<title> log-in</title>


</head>
<body>
	<fieldset style="width:30%"> <legend> LOG-IN </legend>
		<form method= "POST" action="login.php">
			Username <br><input type="text" name="un" size="40"><br>
			Password <br><input type="password" name="pw" size="40"><br>
			<br>
			<input type="submit" name="submit" value="log-In">
		</form>
	</fieldset>
</body>


<?php
if(isset($_POST['submit'])){
	include_once("user.php");
	$name=$_POST['un'];
	$pword=$_POST['pw'];
	$log= new member();

	$pass = md5($pword);

	 
	 $log->check_Id($name,$pword);
	 $row = $log->fetch();

	

	if($row['user_name'] == $name && $row['user_password']== $pword){
		$_SESSION["user"]=$row;//---------define the array of sessions
		header("location:index.php");// --------- define the url
	}
	
		else{
			echo "wrong username or password";
		}

	}



?>



</html>